package com.felight.ems.collections;

import java.util.ArrayList;
import java.util.Arrays;
//import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class AddString {

	public static String generateRandomStringArray(int size) {
		StringBuffer buffer = new StringBuffer();
		String characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		int result = characters.length();
		for (int i = 0; i < size; i++) {
			double temp = Math.random() * result;
			buffer.append(characters.charAt((int) temp));
		}
		return buffer.toString();
	}

	public static void main(String[] args) {
		String[] str = new String[10000];
		
		long start = System.currentTimeMillis();
		for (int i = 0; i < str.length; i++)
			str[i] = generateRandomStringArray(4);
		List<String> names = new LinkedList<String>(Arrays.asList(str));
		names.add(9000, "Ankitha");
		names.remove(8000);
		long end = System.currentTimeMillis();
		System.out.println(end - start);

		long st = System.currentTimeMillis();
		for (int i = 0; i < str.length; i++)
			str[i] = generateRandomStringArray(4);
		List<String> names1 = new ArrayList<String>(Arrays.asList(str));
		names1.add(9000, "Ankitha");
		names1.remove(8000);
		long en = System.currentTimeMillis();
		System.out.println(en - st);

		
		
		
		// Iterator iterator = names.iterator();
		// while(iterator.hasNext()){
		// System.out.println(names);
		 //System.out.println(names1);
		// }

	}

}
